package 力扣日常刷题.木23一月.第13天313;

/**
 * @author 帅小伙
 * @date 2022/3/13
 * @description
 */
public class Demo61 {


    public static void main(String[] args) {
        System.out.println(digArtifacts(2, new int[][]{{0, 0, 0, 0}, {0, 1, 1, 1}}, new int[][]{{0, 0}, {0, 1}}));
    }
    public static int digArtifacts(int n, int[][] artifacts, int[][] dig) {
        boolean[][] isDid = new boolean[n][n];
        for (int[] ints : dig) {
            isDid[ints[0]][ints[1]] = true;
        }

        int ans = 0;
        for (int[] artifact : artifacts) {
            int x = artifact[0],y = artifact[1];
            int nx = artifact[2],ny = artifact[3];
            boolean flag = true;
            for (int i = x; i < nx+1; i++) {
                for (int j = y; j < ny +1; j++) {
                    if(!isDid[i][j]) flag = false;
                }
            }
            if(flag) ans++;
        }
        return ans;
    }
}
